﻿using System.Collections.Generic;

namespace PSE.Deployment.ConfigurationManager.Controls
{
	/// <summary>
	/// Classe base e abstrata que contem os dados basicos para adicao de controles em um TreeView
	/// </summary>
	public abstract class TreeViewItemBase
	{
		bool _hasUpdateConfigInsideSubGroup = false;
		GroupTreeViewItem _parentItem = null;
		string _header;
		List<TreeViewItemBase> _children;
		bool _isExpanded;

		public bool HasUpdateConfigInsideSubGroup
		{
		  get { return _hasUpdateConfigInsideSubGroup; }
		  internal set
		  {
			_hasUpdateConfigInsideSubGroup = value;
			if (_parentItem != null)
			{
				_parentItem.HasUpdateConfigInsideSubGroup = value;
			}
		  }
		}
		public GroupTreeViewItem ParentItem
		{
			get { return _parentItem; }
			internal set { _parentItem = value; }
		}
		public string Header
		{
			get { return _header; }
			set { _header = value; }
		}
		public List<TreeViewItemBase> Children
		{
			get { return _children; }
			set { _children = value; }
		}
		public bool IsExpanded
		{
			get { return _isExpanded; }
			set { _isExpanded = value; }
		}

		public TreeViewItemBase()
		{
			this.Children = new List<TreeViewItemBase>();
		}

		public TreeViewItemBase(string header, GroupTreeViewItem parentItem) : this()
		{
			this.Header = header;
			this.ParentItem = parentItem;
		}
	}
}